package controller;

import java.sql.DriverManager;
import java.sql.Connection;

public class DBConection {
	public static final Connection MYSQL = getConnection("localhost:3306",
			"dienmay", "root", "root");

	public static Connection getConnection(String host, String db, String user,
			String pass) {
		try {
			Class.forName("com.mysql.jdbc.Driver");

			String url = "jdbc:mysql://" + host + "/" + db + "?user=" + user
					+ "&password=" + pass + "";
			Connection conn = DriverManager.getConnection(url);
			return conn;
		} catch (Exception e) {
			e.printStackTrace();
			return null;

		}
	}

	public static void main(String[] args) {
		System.out.println(MYSQL);
	}

}
